<?php

namespace App\Http\Controllers\Admin\TotalData;

use App\Http\Requests\Admin\TotalData\StatSumDataRequest;
use App\Services\TotalData\StatService;
use App\Http\Controllers\Admin\BaseController;

class StatController extends BaseController
{

    public function __construct(StatService $statService)
    {
        $this->statService = $statService;
    }

    //汇总数据统计
    public function sumData(StatSumDataRequest $request)
    {
        $reqStartTime = $request->start_time;
        $reqEndTime = $request->end_time;
        $reqDataType = $request->data_type;
        $reqGameId = $request->game_id;
        $sum = [
            'new_users' => 0,
            'active_users' => 0,
            'pay_users' => 0,
            'total_amounts' => 0,
        ];

        $stat = $this->statService->getChannelStat($request, $sum);

        return view('total_data.stat.sumData', compact(['stat', 'reqStartTime', 'reqEndTime', 'reqDataType', 'sum', 'reqGameId']));
    }
}
